package com.example.myapplication.module.adapter

import android.app.Activity
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.CheckedTextView
import com.example.myapplication.R
import com.example.myapplication.databinding.ItemChooseCloudBinding
import com.example.myapplication.entity.CloudBean
import com.example.mylibrary.adapter.BaseRecyclerAdapter

class CloudAdapter(activity: Activity) : BaseRecyclerAdapter<ItemChooseCloudBinding>(activity) {
    var cloudMap: MutableList<CloudBean> = mutableListOf()
        set(value) {
            field = value
            notifyDataSetChanged()
        }

    override fun getViewHolder(baseViewHolder: BaseViewHolder) {

    }

    override fun getBinding(
        inflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ItemChooseCloudBinding {
        return ItemChooseCloudBinding.inflate(inflater,parent,false)
    }


    override fun bindHolder(holder: BaseViewHolder, position: Int) {
        val cloudBean = cloudMap[position]
        viewBinding.ctvCloud.text = cloudBean.cloudName
        viewBinding.ctvCloud.isChecked = cloudBean.cloudCheck
    }

    override fun getItemCount(): Int {
        return cloudMap.size
    }


}
